package aaaClicker;

import java.util.ArrayList;
import java.util.List;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import com.attilax.core;
import com.attilax.io.filex;

public class ListParser {
	
	public static void main(String[] args) {
String f="E:\\国内高匿免费HTTP代理IP - 快代理.htm";
String t=filex.read(f);
List li=new ListParser().getlist(t);
System.out.println(core.toJsonStrO88(li));

	}

	public List<String> getlist(String t) {
		 List<String> li=new ArrayList<String>();
		Document doc = null;
		//filex.write(path + ".htm", html);
		doc = Jsoup.parse(t);
		Elements tabs = doc.select("table");  
		Element tab=tabs.get(0);
		Elements trs=	tab.select("tr");
		for (Element tr : trs) {
			try {
				Elements tds=tr.select("td");
				String host=tds.get(0).text();
				String port=tds.get(1).text();
				li.add(host+":"+port);
			} catch (Exception e) {
				// TODO: handle exception
			}
			
		}
		
		return li;
	}

}
